﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BDS3M.Controls
{
    public partial class BoxSendedMail : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string iduser = Session["Employee_ID"].ToString();
                rpt_listmail.DataSource = DAL.DCollector.DBCollector.Instance.Paging7Param("paging7Param", "tbl_Message", "Message_Date", "1", "15", "desc", "Message_From", iduser.ToString(), true);
                rpt_listmail.DataBind();
            }
        }
        public string getUserfromID(string id)
        {
            return DAL.DCollector.DBCollector.Instance.StoredSelectAllTableWhereID("tbl_Employee", "Employee_ID", id).Rows[0]["Employee_User"].ToString();
        }

        protected void rpt_listmail_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
          
                if (e.CommandName == "delete")
                {
                    // Xoa
                    int id = Convert.ToInt32(e.CommandArgument.ToString());
                    DAL.DCollector.DBCollector.Instance.StoredProcedureDeleteByRows("tbl_Message", "Message_ID", id.ToString());
                    Response.Redirect("/thudagui");
                }   
        }
    }
}